package com.example.address_list.slice;

import com.example.address_list.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice {
    Button add,see;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        add= (Button) findComponentById(ResourceTable.Id_button_add);
        see= (Button) findComponentById(ResourceTable.Id_button_see);
        see.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent intent=new Intent();
                present(new main_seeSlice(),intent);
            }
        });
        add.setClickedListener(component -> add_intent());
    }
    private void add_intent() {
        Intent intent=new Intent();
        present(new main_addSlice(),intent);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
